package com.hosever.coreTest;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * 泛型测试
 * @author Sever
 *
 */
public class GernericTest {
	public static void main(String[] args) throws Exception {
		List<Integer> listInteger = new ArrayList<Integer>();
		listInteger.add(1);
		List<String> listString = new ArrayList<String>();
		listString.add("string");
		printCollection(listInteger);
		printCollection(listString);
	}

	public static <T> void printCollection(Collection<T> collection) {
		for (Object obj : collection) {
			System.out.println(obj);
		}
	}
}